// 存放 initialState 和 reducer 函数
import * as actionTypes from './constants';
import { fromJS } from 'immutable';  // 这里用到 fromJS 是指把JS数据结构转化成immutatale数据结构

const defaultState = fromJS({
    bannerList: [],
    recommentList: [],
    enterLoading: true,
});

// eslint-disable-next-line
export default (state = defaultState, action) => {
    switch (action.type) {
        case actionTypes.CHANGE_BANNER:
            return state.set('bannerList', action.data);
        case actionTypes.CHANGE_RECOMMEND_LIST:
            return state.set('recommendList', action.data);
        case actionTypes.CHANGE_ENTER_LOADIND:
            return state.set('enterLoading', action.data);
        default:
            return state;
    };
};




